import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
import { values } from 'lodash-es';
import { log } from 'console';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: 'EQCS系统ID',
    align: 'center',
    dataIndex: 'eqcsId',
  },
  {
    title: '单位',
    align: 'center',
    dataIndex: 'company',
  },
  {
    title: '地址',
    align: 'center',
    dataIndex: 'address',
  },
  {
    title: '计量器具名称',
    align: 'center',
    dataIndex: 'name',
  },
  {
    title: '规格参数',
    align: 'center',
    dataIndex: 'type',
  },
  {
    title: '出厂编号',
    align: 'center',
    dataIndex: 'code',
  },
  {
    title: '设备号',
    align: 'center',
    dataIndex: 'deviceCode',
  },
  {
    title: '抢号',
    align: 'center',
    dataIndex: 'gunCode',
  },
  {
    title: '制造单位',
    align: 'center',
    dataIndex: 'madeInCompany',
  },
  {
    title: '所属区县',
    align: 'center',
    dataIndex: 'region',
  },
  {
    title: '所属区县编码',
    align: 'center',
    dataIndex: 'regionCode',
  },
  {
    title: '备注',
    align: 'center',
    dataIndex: 'note',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '设备号',
    field: 'deviceCode',
    component: 'Input',
  },
  {
    label: '区县',
    field: 'region',
    component: 'Input',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: 'EQCS系统ID',
    field: 'eqcsId',
    component: 'Input',
  },
  {
    label: '单位',
    field: 'company',
    component: 'Input',
    rules: [{ required: true, trigger: 'blur' }],
  },
  {
    label: '地址',
    field: 'address',
    component: 'Input',
    rules: [{ required: true, trigger: 'blur' }],
  },
  {
    label: '计量器具名称',
    field: 'name',
    component: 'Input',
    rules: [{ required: true, trigger: 'blur' }],
  },
  {
    label: '规格参数',
    field: 'type',
    component: 'Input',
    rules: [{ required: true, trigger: 'blur' }],
  },
  {
    label: '出厂编号',
    field: 'code',
    component: 'Input',
    rules: [{ required: true, validator: rules.Excludeminus, trigger: 'blur' }],
  },
  {
    label: '设备号',
    field: 'deviceCode',
    component: 'Input',
    componentProps: {
      disabled: true, // 设置为不可编
    },
  },
  {
    label: '抢号',
    field: 'gunCode',
    component: 'Input',
    componentProps: {
      disabled: true, // 设置为不可编
    },
  },
  {
    label: '制造单位',
    field: 'madeInCompany',
    component: 'Input',
    rules: [{ required: true, trigger: 'blur' }],
  },
  {
    label: '所属区县',
    field: 'region',
    component: 'Input',
    rules: [{ required: true, trigger: 'blur' }],
  },
  {
    label: '所属区县编码',
    field: 'regionCode',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'note',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  eqcsId: { title: 'EQCS系统ID', order: 0, view: 'text', type: 'string' },
  company: { title: '单位', order: 1, view: 'text', type: 'string' },
  address: { title: '地址', order: 2, view: 'text', type: 'string' },
  name: { title: '计量器具名称', order: 3, view: 'text', type: 'string' },
  type: { title: '规格参数', order: 4, view: 'text', type: 'string' },
  code: { title: '出厂编号', order: 5, view: 'text', type: 'string' },
  deviceCode: { title: '设备号', order: 6, view: 'text', type: 'string' },
  gunCode: { title: '抢号', order: 7, view: 'text', type: 'string' },
  madeInCompany: { title: '制造单位', order: 8, view: 'text', type: 'string' },
  region: { title: '所属区县', order: 9, view: 'text', type: 'string' },
  regionCode: { title: '所属区县编码', order: 10, view: 'text', type: 'string' },
  note: { title: '备注', order: 11, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
